2caaa8
@@ -1,5 +1,5 @@
 /*
- * Copyright 2002-2014 the original author or authors.
+ * Copyright 2002-2015 the original author or authors.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -667,7 +667,9 @@
public class SingleConnectionFactory implements ConnectionFactory, QueueConnecti
 		@Override
 		public void onException(JMSException ex) {
 			synchronized (connectionMonitor) {
-				for (ExceptionListener listener : this.delegates) {
+				// Iterate over temporary copy in order to avoid ConcurrentModificationException,
+				// since listener invocations may in turn trigger registration of listeners...
+				for (ExceptionListener listener : new LinkedHashSet<ExceptionListener>(this.delegates)) {
 					listener.onException(ex);
 				}
 			}
